
<html>
    <head>
        <script type="text/javascript">
            var aSignupFb = document.getElementById("aSignupFb");
            currentUrl = "http://yourstyle.name/raovat/signupFb.php";	
			currentUrl = encodeURIComponent(currentUrl);
			function openPopup(){
                url = "https://www.facebook.com/dialog/oauth?client_id=618836824809238&scope=publish_stream&redirect_uri=" + currentUrl + "&display=popup";
			    var width = 600;
                var height = 300;
                var left = parseInt((screen.availWidth/2) - (width/2));
                var top = parseInt((screen.availHeight/2) - (height/2));
                var windowFeatures = "width=" + width + ",height=" + height + ",status,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top;

                newwindow= window.open(url,'Login_by_facebook', windowFeatures);
                newwindow.focus();
            }
        </script>
    </head>
    <body>
        <a href="#" title="Signup with facebook" id="aSignupFb" onclick="return openPopup();">Signup</a>
        <div id="fb-root"></div>
        <script>
            window.fbAsyncInit = function() {
                FB.init({
                    appId      : '618836824809238', // App ID
                    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel Fileid=
                    status     : true, // check login status
                    cookie     : true, // enable cookies to allow the server to access the session
                    xfbml      : true  // parse XFBML
                });

                // Here we subscribe to the auth.authResponseChange JavaScript event. This event is fired
                // for any authentication related change, such as login, logout or session refresh. This means that
                // whenever someone who was previously logged out tries to log in again, the correct case below 
                // will be handled. 
                FB.Event.subscribe('auth.authResponseChange', function(response) {
                    if (response.status === 'connected') {
                        testAPI();
                    } else if (response.status === 'not_authorized') {
                        FB.login();
                    } else {
                        FB.login();
                    }
                });
            };
            // Load the SDK asynchronously
            (function(d){
                var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
                if (d.getElementById(id)) {return;}
                js = d.createElement('script'); js.id = id; js.async = true;
                js.src = "//connect.facebook.net/en_US/all.js";
                ref.parentNode.insertBefore(js, ref);
            }(document));

            // Here we run a very simple test of the Graph API after login is successful. 
            // This testAPI() function is only called in those cases. 
            function testAPI() {
                console.log('Welcome!  Fetching your information.... ');
                FB.api('/me', function(response) {
                    console.log('Good to see you, ' + response.name + '.');
                    console.log(response);
                    console.log("http://graph.facebook.com/"+ response.id +"/picture");
                });
            }
        </script>

        <!--
          Below we include the Login Button social plugin. This button uses the JavaScript SDK to
          present a graphical Login button that triggers the FB.login() function when clicked.
        
          Learn more about options for the login button plugin:
          /docs/reference/plugins/login/ -->
        <br/><br/>
        <!--
        <fb:login-button show-faces="true" with="200" max-rows="1"></fb:login-button>
        -->
        <!-- custom login button -->
<!--        <a href="#" onclick="fblogin();return false;"><img src="images/my_login.png">SignUp hehe</a>-->


        <script>
//            //your fb login function
//            function fblogin() {
//                FB.login(function(response) {
//                    console.log("Login roi");
//                }, {scope:'read_stream,publish_stream,offline_access'});
//            }
        </script>

    </body>
</html>

<?php
?>